package com.example.hackaton_it_planet.di

import android.content.Context
import androidx.room.Room
import com.example.hackaton_it_planet.data.db.FinanceDatabase
import com.example.hackaton_it_planet.data.db.purchase.PurchaseDao
import com.example.hackaton_it_planet.data.db.wallet.WalletDao
import dagger.Module
import dagger.Provides

@Module
class DatabaseModule {

    @Provides
    fun provideDataBase(context: Context): FinanceDatabase =
        Room.databaseBuilder(
            context,
            FinanceDatabase::class.java,
            "finance.db"
        ).build()

    @Provides
    fun provideWalletDAO(db: FinanceDatabase): WalletDao =
        db.walletDAO

    @Provides
    fun providePurchaseDAO(db: FinanceDatabase): PurchaseDao =
        db.purchaseDao
}